package com.yunkecn.wechatfilehandler;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class Box {

    private static Box box;

    private List<Integer> apples;

    private int total;


    static {
        box = new Box();
        box.init();
    }

    private Box() {

    }

    private void init() {
        apples = new CopyOnWriteArrayList<>();
        for (int i = 0; i < 50; i++) {
            this.add();
        }
    }

    public static Box getInstance() {
        return box;
    }

    public void add() {

        apples.add(total);
        total ++;
    }

    public void remove(Integer apple) {
        apples.remove(apple);
    }

    public List<Integer> getApples() {
        return apples;
    }
}
